# Maintainer: Alexey Pavlov <alexpux@gmail.com>

_realname=adwaita-icon-theme
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=48.0
pkgrel=1
pkgdesc="GNOME standard icons (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clangarm64')
url="https://gitlab.gnome.org/GNOME/adwaita-icon-theme"
license=("spdx:LGPL-3.0-or-later OR CC-BY-SA-3.0")
makedepends=(
  "${MINGW_PACKAGE_PREFIX}-gtk3"
  "${MINGW_PACKAGE_PREFIX}-meson"
  "${MINGW_PACKAGE_PREFIX}-ninja"
  "${MINGW_PACKAGE_PREFIX}-pkgconf"
)
depends=(
  "${MINGW_PACKAGE_PREFIX}-adwaita-icon-theme-legacy"
  "${MINGW_PACKAGE_PREFIX}-hicolor-icon-theme"
  "${MINGW_PACKAGE_PREFIX}-librsvg"
  "${MINGW_PACKAGE_PREFIX}-gtk-update-icon-cache"
)
source=(
  "https://download.gnome.org/sources/${_realname}/${pkgver:0:2}/${_realname}-${pkgver}.tar.xz"
)
noextract=("${_realname}-${pkgver}.tar.xz")
sha256sums=('847068888650d9673115be6dbf2bfdc31a46aebc528a6a9db4420e60e656b8d4')

prepare() {
  tar -xf "${_realname}-${pkgver}.tar.xz" || tar -xf "${_realname}-${pkgver}.tar.xz"
}

build() {
  MSYS2_ARG_CONV_EXCL="--prefix=" \
    "${MINGW_PREFIX}"/bin/meson.exe setup \
      --prefix="${MINGW_PREFIX}" \
      --wrap-mode=nodownload \
      --auto-features=enabled \
      --buildtype=plain \
      "${_realname}-${pkgver}" \
      "build-${MSYSTEM}"

  "${MINGW_PREFIX}"/bin/meson.exe compile -C "build-${MSYSTEM}"
}

package() {
  "${MINGW_PREFIX}"/bin/meson.exe install -C "build-${MSYSTEM}" --destdir "${pkgdir}"

  install -Dm644 "${srcdir}/${_realname}-${pkgver}"/COPYING "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/COPYING"
  install -Dm644 "${srcdir}/${_realname}-${pkgver}"/COPYING_LGPL "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/COPYING_LGPL"
  install -Dm644 "${srcdir}/${_realname}-${pkgver}"/COPYING_CCBYSA3 "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/COPYING_CCBYSA3"
}
